@extends('layouts.admin')
@section('style')
    <style type="text/css">
        .layui-form-label{width:150px;}
    </style>
@endsection
@section('content')
    <div class="admin_main">
        <div class="admin_header_fixed">
            <div class="admin_header clearfix">
                <div class="title"><i></i>系统设置</div>
                <div class="action"></div>
            </div>
        </div>
        <div class="admin_base">
            <div class="box_form">
                <div class="box_content">
                    <div class="layui-tab">
                        <ul class="layui-tab-title">
                            <li class="layui-this">基本设置</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <form method="post" action="{{ url('config') }}"  id="UserForm"  class="layui-form" novalidate="1">
                                    {{ csrf_field() }}
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">同店铺补单间隔</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="interval"  lay-verify="interval" data-title="同店铺补单间隔" value="{{ $configs['interval']['value'] }}" id="interval"  class="layui-input">
                                            <span class="layui-form-mid layui-word-aux" style="color:orangered!important;">如果同一账号在同一店铺补单时间超过这个间隔则给出提示&nbsp;<label style="color:blue">设置为0不限制</label></span>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">不同店铺补单间隔</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="interval_diff"  lay-verify="interval_diff" data-title="不同店铺补单间隔" value="{{ $configs['interval_diff']['value'] }}" id="interval_diff"  class="layui-input">
                                            <span class="layui-form-mid layui-word-aux" style="color:orangered!important;">如果同一账号在不同店铺补单时间超过这个间隔则给出提示&nbsp;<label style="color:blue">设置为0不限制</label></span>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">提示类型</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="tiptype" value="1" title="提示后可选择继续" {{ $configs['tiptype']['value']==1?'checked':'' }}>
                                            <input type="radio" name="tiptype" value="2" title="提示后不可继续" {{ $configs['tiptype']['value']==2?'checked':'' }}>
                                        </div>
                                    </div>
                                    <div class="layui-form-item admin_bottom">
                                        <div class="layui-input-inline">
                                            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存设置</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="admin_bottom"></div>
    </div>
@endsection
@section('script')
    <script type="text/javascript" src="{{ asset('files/ueditor/ueditor.config.js') }}" ></script>
    <script type="text/javascript" src="{{ asset('files/ueditor/ueditor.all.js') }}" ></script>
    <script type="text/javascript" src="{{ asset('files/ueditor/lang/zh-cn/zh-cn.js') }}" ></script>
    <script type="text/javascript">
        layui.use(['form','element','layer','utils','formField'], function(){
            var form = layui.form;
            var element= layui.element;
            var URL = layui.utils.URL;
            var $ = layui.$;

            form.on('radio(mapid)',function(data){
                var _elem = $(data.elem);
                var value = _elem.val();
                $('.mapid').addClass('layui-hide');
                $('.mapid_'+value).removeClass('layui-hide');
                $('.mapid_'+value).addClass('layui-show');
            })

            form.on('submit(save)',function(data){
                var url  = $(data.form).prop('action');
                var data = data.field;
                URL.post(url,data,{
                    dataType:'json',
                    success:function(res){
                        if(res.code==1){
                            layer.msg(res.message,{icon:6,times:2000},function(){})
                        }else{
                            layer.msg(res.message,{icon:5,times:2000});
                        }
                    }
                })
                return false;
            })
        });
    </script>
@endsection